import { Component, OnInit } from '@angular/core';
import { UploadFile, MessageService } from '@iux/live';
import { Observable } from 'rxjs';
import { HttpResponse } from '@angular/common/http';

@Component({
  selector: 'app-demo5',
  templateUrl: './demo5.component.html',
  styles: []
})
export class Demo5Component implements OnInit {

  constructor(private messageSerive: MessageService) { }

  ngOnInit() {
  }

  beforeSuccess = (response: HttpResponse<any>, file: UploadFile) => {
    
    const imageSize = response.body.size;

    if (imageSize.width !== 300 && imageSize.height.height !== 300) {
      this.messageSerive.error('仅支持300*300大小图片');
      return false;
    }

    return true;

  }

}
